import React from "react";
import { Link,withRouter } from "react-router-dom";
import { Tabs } from "antd-mobile";
import { $pre } from "../../../../http/http";
import { filterPrice } from "../../../../filters";
import "./New.less";
function New(props) {
  let { news } = props;
  return (
    <div className="news">
      <Tabs
        defaultActiveKey="1"
        onChange={(key) => {
          props.history.push("/list?id=" + key);
        }}>
      </Tabs>
        {news.map((item) => {
          return (
            <Link className="news-shop" to={'/detail/'+item.id} title={item.newsname} key={item.id}>
              <img src={$pre + item.img} alt="" />
              <div>商品名称：{item.newsname}</div>
              <div>价格：{filterPrice(item.price)}</div>
            </Link>
          );
        })}
      
    </div>
  );
}
export default withRouter(New);
